<?php 
if(KT!='KhiThe') exit;
class intros_controller extends intros_model{
		
	public function __construct(){
		global $lang;
		$this->lang = $lang;
		$this->lang['sms'] = '';
		parent::__construct();
		parent::addObject('khithe_template');
		parent::addObject('khithe_string');
		parent::addObject('khithe_request');
		parent::addObject('khithe_upload');
	}
	
	public function index_action()
	{
        $array['FullContents'] = null;
        $CID = $this->valUrl(1);

        if(isset($_POST['FullContents']) && !empty($_POST['FullContents']))
        {
            $arrx['ID'] = $CID;
            $arrx['FullContents'] = $_POST['FullContents'];
            $arrayID = parent::get_intro($CID);

            if( empty($arrayID['CID']) ){

                parent::insert_intro($arrx);

            }else{

                parent::update_intro($arrx);
            }
        }

        $arr  = parent::get_cat_intro($CID);
        $array = parent::get_intro($CID);
        $arr['FullContents'] = $array['FullContents'];



        $strHtmlContent = $this->khithe_display('editor');
        $strHtmlContent = $this->khithe_assign($strHtmlContent, $arr);
        $strHtmlContent = $this->khithe_assign($strHtmlContent, $this->lang);
        return $strHtmlContent;
	}

}
?>